<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>JPress网站初始化</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="#(CPATH)/static/components/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/components/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/components/ionicons/css/ionicons.min.css">
    <link rel="stylesheet" href="#(CPATH)/static/adminlte/css/AdminLTE.min.css">

    <!--[if lt IE 9]>
    <script src="#(CPATH)/static/html5shiv/html5shiv.min.js"></script>
    <script src="#(CPATH)/static/respond/respond.min.js"></script>
    <![endif]-->
    <style>

        .login-page {
            background-image: url("#(CPATH)/static/commons/img/loginbg.png");
            background-size: cover;
        }

        .form-group {
            text-align: left;
        }

        .login-box {
            margin: 2% auto;
            width: 660px;
            padding: 0;
        }

        .page-header {
            margin: 50px 0 30px 0;
            font-size: 16px;
            color: #999;
            text-align: left;
        }


    </style>
</head>
<body class="hold-transition login-page">

<div class="row">
    <div class="login-box text-center">
        <div class="login-box-body">
            <form class="form-horizontal form-setting"
                  action="#(CPATH)/install/doInstall" method="post" id="form">
                <div class="form-group">
                    <div class="col-sm-12">
                        JPress用户您好，在使用JPress之前，请先初始化网站基本信息。
                    </div>
                </div>
                <h4 class="page-header" style="margin-top: 20px">网站信息</h4>
                <div class="form-group">
                    <label class="col-sm-2 control-label">网站名称</label>

                    <div class="col-sm-9">
                        <input type="input" class="form-control" placeholder="取个好听的名字"
                               name="web_name">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">网站标题</label>

                    <div class="col-sm-9">
                        <input type="input" class="form-control" placeholder="设置你的网站标题"
                               name="web_title">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">网站副标题</label>

                    <div class="col-sm-9">
                        <input type="input" class="form-control" placeholder="及副标题..."
                               name="web_subtitle">
                    </div>
                </div>

                <h4 class="page-header">超级管理员</h4>

                <div class="form-group">
                    <label class="col-sm-2 control-label">账号</label>
                    <div class="col-sm-9">
                        <input type="input" class="form-control" placeholder="管理员的登录账号"
                               name="username">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">密码</label>
                    <div class="col-sm-9">
                        <input type="password" class="form-control" placeholder="及密码"
                               name="pwd">
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">确认密码</label>
                    <div class="col-sm-9">
                        <input type="password" class="form-control" placeholder="..."
                               name="confirmPwd">
                    </div>
                </div>

                <div class="row">
                    <div class="col-xs-offset-3 col-xs-6 " style="padding-top: 15px">
                        <button type="button" id="submit" class="btn btn-primary btn-block btn-flat"> 确认初始化</button>
                    </div>
                </div>

            </form>

        </div>
    </div>
</div>

<script src="#(CPATH)/static/components/jquery/jquery.min.js"></script>
<script src="#(CPATH)/static/components/jquery/jquery.form.min.js"></script>
<script src="#(CPATH)/static/components/bootstrap/js/bootstrap.min.js"></script>
<script>

    $("#submit").on("click", function () {
        $("#form").ajaxSubmit({
            type: "post",
            success: function (data) {
                if (data.state == "ok") {
                    alert("网站基本信息初始化成功，请登陆。")
                    location.href = "#(CPATH)/admin/login";
                } else {
                    alert(data.message);
                }
            },
            error: function () {
                alert("网络错误，请稍后重试");
            }
        });
    })
</script>

</body>
</html>
